import { IToolTipItem } from "../../../../../com/mui/manager/IToolTipItem";
import { ObjCreate } from "../../common/ObjCreate";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { Language } from "../../../../../extend/language/Language";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../resource/ResFileConst";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { ItemData } from "../../../resource/info/ItemData";
import { DateParser } from "../../../../common/tools/DateParser";
import { ClockManager } from "../../../manager/ClockManager";
import { ToolTipsManager } from "../../../../../com/mui/manager/ToolTipsManager";
type int = number;
//class SpMountTip
    
    export  class SpMountTip /* flash.display.Sprite */ implements IToolTipItem
    {
        constructor()
        {
            
            this.initView();
            return;
        }

        /* internal  */initView(): void
        {
            this._expUp25 = ObjCreate.createBitmap("", 0, 0, this);
            this._expUp50 = ObjCreate.createBitmap("", 0, 0, this);
            this._expUp100 = ObjCreate.createBitmap("", 0, 0, this);
            this._expUp25.visible = false;
            this._expUp50.visible = false;
            this._expUp100.visible = false;
            this.toolTipData = HTMLUtil.addColor(Language.getString(70085), "#ffffff");
            LoaderHelp.addResCallBack(ResFileConst.mountExpBm, this.onLoadBmResource);
            return;
        }

        /* internal  */onLoadBmResource(): void
        {
            this._expUp25.bitmapData = GlobalClass.getBitmapData(ImagesConst.mountFeed25);
            this._expUp50.bitmapData = GlobalClass.getBitmapData(ImagesConst.mountFeed50);
            this._expUp100.bitmapData = GlobalClass.getBitmapData(ImagesConst.mountFeed100);
            return;
        }

        public updateInfo(arg1: ItemData): void
        {
            var loc1=null;
            var loc2=null;
            this._mountIData = arg1;
            if (arg1) 
            {
                this.curFull = this._mountIData.itemExInfo.feed_degree;
                if (this.curFull >= 100 && this.curFull <= 119) 
                {
                    this._expUp50.visible = true;
                    var loc3;
                    this._expUp100.visible = loc3 = false;
                    this._expUp25.visible = loc3;
                }
                else if (this.curFull != 120) 
                {
                    this._expUp100.visible = true;
                    this._expUp50.visible = loc3 = false;
                    this._expUp25.visible = loc3;
                }
                else 
                {
                    this._expUp25.visible = true;
                    this._expUp100.visible = loc3 = false;
                    this._expUp50.visible = loc3;
                }
                loc1 = DateParser.strToDateNormal(this._mountIData.itemExInfo.l_feed_dt);
                loc2 = ClockManager.instance.nowDate;
                if (!(loc1.getMonth() === loc2.getMonth()) || !(loc1.getFullYear() === loc2.getFullYear()) || !(loc1.getDate() === loc2.getDate())) 
                {
                    this.curFull = 0;
                    this._expUp100.visible = true;
                    this._expUp50.visible = loc3 = false;
                    this._expUp25.visible = loc3;
                }
            }
            else 
            {
                this._expUp25.visible = false;
                this._expUp50.visible = false;
                this._expUp100.visible = true;
            }
            return;
        }

        public get toolTipData()
        {
            return this._toolTipData;
        }

        public set toolTipData(arg1)
        {
            if (arg1 == null || arg1 == "") 
            {
                ToolTipsManager.unregister(this);
            }
            else 
            {
                ToolTipsManager.register(this);
            }
            this._toolTipData = arg1;
            return;
        }

        /* internal */ /* var */_toolTipData;

        /* internal */ /* var */_expUp25: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_expUp50: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_expUp100: Object /* flash.display.Bitmap */;

        /* internal */ /* var */curFull: int;

        /* internal */ /* var */_mountIData: ItemData;
    }
